

function* f() {
  for (let i = 0; i < 10; i++)
    yield i
}

x = f()
for (let r = x.next(); !r.done; r = x.next()) {
  console.log(r.value)
}

